package com.jiaming.employee.department.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jiaming.employee.common.bean.vo.MyPageVO;
import com.jiaming.employee.department.bean.pojo.Department;
import com.jiaming.employee.department.mapper.DepartmentMapper;
import com.jiaming.employee.department.service.IDepartmentService;
import com.jiaming.employee.salary.bean.vo.GetSalaryPageVO;
import org.springframework.stereotype.Service;

/**
 * @author dragon
 * @create 2021-05-15 11:26
 */
@Service
public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Department> implements IDepartmentService {
    @Override
    public MyPageVO<Department> pageDmp(GetSalaryPageVO getSalaryPageVO) {
        Page<Department> departmentPage = new Page<>();
        departmentPage.setCurrent(getSalaryPageVO.getPageNum());
        departmentPage.setSize(getSalaryPageVO.getPageSize());
        this.page(departmentPage);
        MyPageVO<Department> departmentMyPageVO = new MyPageVO<>();
        departmentMyPageVO.setPageSize(departmentPage.getSize());
        departmentMyPageVO.setItems(departmentPage.getRecords());
        departmentMyPageVO.setPageNum(departmentPage.getCurrent());
        departmentMyPageVO.setTotalItems(departmentPage.getTotal());
        departmentMyPageVO.setTotalPages(departmentPage.getPages());
        return departmentMyPageVO;
    }
}
